package com.bqtt.tumor.demo.entity;

import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.bqtt.tumor.demo.business.DeseaseService;
import com.bqtt.tumor.demo.business.HealthUserService;
import com.bqtt.tumor.demo.business.MedicalCaseService;

@Entity
@Table(name="image_def") 
public class Image  implements IDBEntity{

	@Id 
    @Column(name="image_def_id")    
    @GeneratedValue(strategy=GenerationType.IDENTITY) 
	private Integer image_def_id;
	
	@Column(name="case_id")   
	private Integer case_id;
	
	@Column(name="type")   
	private Integer type;
	
	@Column(name="image_url",length=255)   
	private String image_url;
	
	@Column(name="image_features",length=255)   
	private String image_features;

	@Transient
	private String patientName;
	
	@Transient
	private String deseaseName;
	
	
	
	public String getPatientName() {
		return patientName;
	}

	public void setPatientName(String patientName) {
		this.patientName = patientName;
	}

	public String getDeseaseName() {
		return deseaseName;
	}

	public void setDeseaseName(String deseaseName) {
		this.deseaseName = deseaseName;
	}

	public Integer getImage_def_id() {
		return image_def_id;
	}

	public void setImage_def_id(Integer image_def_id) {
		this.image_def_id = image_def_id;
	}

	public Integer getCase_id() {
		return case_id;
	}

	public void setCase_id(Integer case_id) {
		this.case_id = case_id;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getImage_url() {
		return image_url;
	}

	public void setImage_url(String image_url) {
		this.image_url = image_url;
	}

	public String getImage_features() {
		return image_features;
	}

	public void setImage_features(String image_features) {
		this.image_features = image_features;
	}

	public Image() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public Map<String, Object> getSQLValidAttributes() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void fillStringField() {
		// TODO Auto-generated method stub
		 MedicalCase medical_case= MedicalCaseService.findById(case_id);
		 String patient_id = medical_case.getHealth_user_id_number();
		 String desease_code = medical_case.getDesease_code();
		 
		 HealthUser tempUser = HealthUserService.getUserByIdNumber(patient_id);
	     if(tempUser!=null)
	     {
	    	 patientName = tempUser.getName();
	     }
	     deseaseName = DeseaseService.getDeseaseNameByCode(desease_code);
	}

	@Override
	public void fillDBfields() {
		// TODO Auto-generated method stub
		
	}
	
	
	
	
	
}
